﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CoreCalc.SheetDefinedFunctions.Accellerator
{
    class AccCellArea : AccExpr
    {
        public readonly ArrayView view;

        private float[,] floatArray;

        public AccCellArea(ArrayView view)
        {
            this.view = view;
            GenerateFloatArray();
        }

        void GenerateFloatArray()
        {

            floatArray = new float[view.Cols, view.Rows];

            for (int i = 0; i < view.Cols; i++)
            {
                for (int j = 0; j < view.Rows; j++)
                {
                    floatArray[i, j] = (float)((view[i, j] as NumberValue).value);
                }
            }
        }

        protected override Microsoft.ParallelArrays.FloatParallelArray GenerateFPA(AccInputInfo info, int CallID)
        {
            return new Microsoft.ParallelArrays.FloatParallelArray(floatArray);
        }

    }
}
